<? if(!session_id()); session_start(); ?>
<? 
require("../config.php");
require("../common_start.php");
$errMsg='';

if (isset($_POST['btnLogin'])){
	$uid = $_POST['txtUid'];
	$pwd = $_POST['txtPwd'];
	$sql = "select * from tbl_user where uid='".$uid."' and pwd='".$pwd."' limit 1";
	if (mysql_num_rows(mysql_query($sql,$conn))>0) {
		$log = $uid;
		session_register("log");
		$_SESSION['log'] = $uid;
		echo "<script>window.location='./'</script>";	//co le chuyen den thu muc hien tai => file index.php???
	}else{
		$errMsg="Tên đăng nhập / mật khẩu không đúng !";
	}
} 
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<link rel="stylesheet" type="text/css" href="css/anylinkcssmenu.css" />
<link rel="stylesheet" href="../css/menuv.css" type="text/css" />
<link rel="stylesheet" href="../css/scroll_vertical.css" type="text/css" />
<link rel="stylesheet" href="../css/queryLoader.css" type="text/css" />
<link rel="stylesheet" href="../css/tabbn.css" type="text/css" />
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<title>Login Now !</title>
<script language="javascript" src="../lib/md5.js"></script>
<script language="javascript" src="../lib/javascript.lib.js"></script>
<script language="javascript" src="../lib/varAlert.vn.unicode.js"></script>
<script language="javascript">
function btnLogin_onClick(){
	if(test_empty(document.frmLogin.txtUid.value)){
		alert('Hãy nhập "tên đăng nhập" !');document.frmLogin.txtUid.focus();return false;
	}
	if(test_empty(document.frmLogin.txtPwd.value)){
		alert('Hãy nhập "mật khẩu" !');document.frmLogin.txtPwd.focus();return false;
	}
	document.frmLogin.txtPwd.value = hex_md5(document.frmLogin.txtPwd.value);
	return true;
}
</script>

</head>





<body onLoad="document.frmLogin.txtUid.focus();">

<form method="post" name="frmLogin" style="padding-top:50px">
<table align="center">
<tr><td>
<div style="border:7px solid #b2b2b2;width:800px">
<table width="800" height="400" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> 
    
    <tr>
      <td width="786"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="40" align="center"><? if($errMsg!=''){echo '<p align=center class="err">'.$errMsg.'<br>&nbsp;</p>';}?></td>
        </tr>
        <tr>
          <td align="center"><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
            
         
            <tr>
             
              <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  
                    <div align="center"><img src="images/logo.png"></div>
                  <tr align="left">
                    <td colspan="2" height="10">&nbsp;</td>
                  </tr>
                  <tr>
                    <td width="40%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td align="left" valign="top" class="font_login"></td>
                        </tr>
                  
                        <tr>
                          <td align="center"><img src="images/lock.png" /></td>
                        </tr>
                    </table></td>
                    <td width="60%" align="left" valign="top"><table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
                        
                        <tr>
                      
                          <td>
						  <div style="font-family:Arial, Helvetica, sans-serif; font-size:12px">
						  <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
                              <tr>
                                <td class="font_xam">Username </td>
                                <td><input type="text" name="txtUid" size="20"></td>
                              </tr>
                              <tr>
                                <td valign="top" class="font_xam">Password</td>
                                <td valign="top"><input type="password" name="txtPwd" size="20"></td>
                              </tr>
                              <tr>
                                <td align="right" valign="top"><input name="rem" type="checkbox" id="rem" value="1" {checked} /></td>
                                <td valign="top" class="font_login">Lưu lại mật khẩu </td>
                              </tr>
                              <tr>
                                <td>&nbsp;</td>
                                <td><input type="submit" class="wbuttons" name="btnLogin" value="Đăng nhập"  onClick="return btnLogin_onClick();"/></td>
                              </tr>
                          </table>
						  </div>
						  
						  </td>
                       
                        </tr>
                        
                    </table></td>
                  </tr>
              </table></td>
              
            </tr>
           
          </table></td>
        </tr>
      </table></td>
      
    </tr>
 
</table>
</div>
</td></tr></table>
</form>

	

</body>
</html>
<? require("../common_end.php") ?>

